Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(accessibility): Add accessibility features to Color Picker hue slider #5656

Merged
merged 7 commits into from
Aug 16, 2023

Conversation

ilzamcmed
Copy link
Member

@ilzamcmed ilzamcmed commented Aug 1, 2023

@ilzamcmed
Copy link
Member Author

Hey @pat270 @matuzalemsteles
Can you guys review this PR?
Thanks!

@@ -79,6 +79,7 @@ const ClayColorPickerCustom = ({

{showPalette && (
<button
aria-label={editorActive ? 'close' : 'custom color'}
Copy link
Member Author

@ilzamcmed ilzamcmed Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was something out of scope but since there wasn't any description on this button, I added an aria-label.
Is there any language key we can use on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilzamcmed we don't have a language key because Clay is distributed outside of DXP too so we don't have Liferay.Language.get for example which is just processed in SSR instead we always expose an API to configure aria-labels, in that if we are adopting a pattern of exposing a messages API being the object with keys that are related to language, we can do the same here.

Copy link
Member

@matuzalemsteles matuzalemsteles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just added some comments. The test seems to fail because the snapshot is out of date, can you update them?

@@ -79,6 +79,7 @@ const ClayColorPickerCustom = ({

{showPalette && (
<button
aria-label={editorActive ? 'close' : 'custom color'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilzamcmed we don't have a language key because Clay is distributed outside of DXP too so we don't have Liferay.Language.get for example which is just processed in SSR instead we always expose an API to configure aria-labels, in that if we are adopting a pattern of exposing a messages API being the object with keys that are related to language, we can do the same here.

style={{
background: `hsl(${value}, 100%, 50%)`,
left: x - 7,
<div className="clay-color-form-group">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need it here for this element.

@ilzamcmed ilzamcmed changed the title LPS-190649 Add accessibility features to Color Picker hue slider refactor(accessibility): Add accessibility features to Color Picker hue slider Aug 9, 2023
@matuzalemsteles
Copy link
Member

@ilzamcmed apparently the branch is out of date or something happened that commits are coming from master. Could you see it? it also has some typescript errors.

@ilzamcmed ilzamcmed force-pushed the LPS-190649 branch 3 times, most recently from 8a3ec0a to ec82194 Compare August 10, 2023 14:26
userEvent.keyboard('[ArrowRight]');

expect(handleColorsChange).toBeCalledTimes(2);
expect(handleValueChange).toBeCalledTimes(2);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @matuzalemsteles
The reason I had to add two checks on this test was because to set focus on the slider, I had to use a click and that triggers the onChange function and when i press the arrow key, it triggers again.


userEvent.keyboard('[ArrowLeft]');
expect(handleColorsChange).toBeCalledTimes(2);
expect(handleValueChange).toBeCalledTimes(2);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here

Copy link
Member

@matuzalemsteles matuzalemsteles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilzamcmed thanks IIza, I just added a few comments.

packages/clay-color-picker/src/__tests__/index.tsx Outdated Show resolved Hide resolved
packages/clay-color-picker/src/Hue.tsx Outdated Show resolved Hide resolved
packages/clay-color-picker/src/Hue.tsx Outdated Show resolved Hide resolved
Copy link
Member

@matuzalemsteles matuzalemsteles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matuzalemsteles matuzalemsteles merged commit 7dc9395 into liferay:master Aug 16, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants